﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.QcManagement;
using Digitalmes.Model.ProductManagement;
using Digitalmes.Model.PlanningManagement;

namespace Digitalmes.Model.QcManagement
{
    /// <summary>
    /// 检验表
    /// </summary>
	[Table("QcSheet")]

    [Display(Name = "_Model.QcSheet")]
    public class QcSheet : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._QcSheet._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._QcSheet._WoId")]
        [Comment("工单号")]
        public long? WoId { get; set; }

        public ProductionOrder Wo { get; set; } 


        [Display(Name = "_Model._QcSheet._WoCode")]
        [Comment("工单编号")]
        public string WoCode { get; set; }
        [Display(Name = "_Model._QcSheet._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }

        public Product Product { get; set; }

        [Display(Name = "_Model._QcSheet._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._QcSheet._Sn")]
        [Comment("追溯码")]
        public string Sn { get; set; }
        [Display(Name = "_Model._QcSheet._Template")]
        [Comment("检验模板")]
        public QcTemplate Template { get; set; }
        [Display(Name = "_Model._QcSheet._Template")]
        [Comment("检验模板")]
        public long? TemplateId { get; set; }
        [Display(Name = "_Model._QcSheet._QcOperator")]
        [Comment("检验员")]
        public string QcOperator { get; set; }
        [Display(Name = "_Model._QcSheet._QcResult")]
        [Comment("检验结果")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public QcStatusEnum? QcResult { get; set; }
        [Display(Name = "_Model._QcSheet._Remark")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._QcSheet._QcMode")]
        [Comment("质检模式")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public QcModeEnum? QcMode { get; set; }
        [Display(Name = "_Model._QcInspectRecord._Sheet")]
        [InverseProperty("Sheet")]
        public List<QcInspectRecord> QcInspectRecord_Sheet { get; set; }
        [Display(Name = "_Model._QcSheet._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
